﻿
namespace ATA.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.ChietKhau"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class ChietKhauEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ChietKhauId property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxChietKhauId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ChietKhauId property.
		/// </summary>
		protected System.Windows.Forms.Label uxChietKhauIdLabel;
		
		/// <summary>
		/// DataTimePicker for the StartDate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxStartDate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the StartDate property.
		/// </summary>
		protected System.Windows.Forms.Label uxStartDateLabel;
		
		/// <summary>
		/// DataTimePicker for the EndDate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxEndDate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the EndDate property.
		/// </summary>
		protected System.Windows.Forms.Label uxEndDateLabel;
		
		/// <summary>
		/// ComboBox for the DieuKienGiamGiaId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxDieuKienGiamGiaId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DieuKienGiamGiaId property.
		/// </summary>
		protected System.Windows.Forms.Label uxDieuKienGiamGiaIdLabel;
		
		/// <summary>
		/// TextBox for the GhiChu property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxGhiChu;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the GhiChu property.
		/// </summary>
		protected System.Windows.Forms.Label uxGhiChuLabel;
		
		/// <summary>
		/// DataTimePicker for the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxLastUpdate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.Label uxLastUpdateLabel;
		
		/// <summary>
		/// TextBox for the UpdateBy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxUpdateBy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the UpdateBy property.
		/// </summary>
		protected System.Windows.Forms.Label uxUpdateByLabel;
		
		/// <summary>
		/// TextBox for the Header property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxHeader;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Header property.
		/// </summary>
		protected System.Windows.Forms.Label uxHeaderLabel;
		
		/// <summary>
		/// ComboBox for the NhomKhachHangId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxNhomKhachHangId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the NhomKhachHangId property.
		/// </summary>
		protected System.Windows.Forms.Label uxNhomKhachHangIdLabel;
		#endregion
		
		#region Main entity
		private Entities.ChietKhau _ChietKhau;
		/// <summary>
		/// Gets or sets the <see cref="Entities.ChietKhau"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.ChietKhau"/> instance.</value>
		public Entities.ChietKhau ChietKhau
		{
			get {return this._ChietKhau;}
			set
			{
				this._ChietKhau = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxChietKhauId.DataBindings.Clear();
			this.uxChietKhauId.DataBindings.Add("Text", this.uxBindingSource, "ChietKhauId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxStartDate.DataBindings.Clear();
			this.uxStartDate.DataBindings.Add("Value", this.uxBindingSource, "StartDate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxEndDate.DataBindings.Clear();
			this.uxEndDate.DataBindings.Add("Value", this.uxBindingSource, "EndDate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDieuKienGiamGiaId.DataBindings.Clear();
			this.uxDieuKienGiamGiaId.DataBindings.Add("SelectedValue", this.uxBindingSource, "DieuKienGiamGiaId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxGhiChu.DataBindings.Clear();
			this.uxGhiChu.DataBindings.Add("Text", this.uxBindingSource, "GhiChu", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLastUpdate.DataBindings.Clear();
			this.uxLastUpdate.DataBindings.Add("Value", this.uxBindingSource, "LastUpdate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxUpdateBy.DataBindings.Clear();
			this.uxUpdateBy.DataBindings.Add("Text", this.uxBindingSource, "UpdateBy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxHeader.DataBindings.Clear();
			this.uxHeader.DataBindings.Add("Text", this.uxBindingSource, "Header", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNhomKhachHangId.DataBindings.Clear();
			this.uxNhomKhachHangId.DataBindings.Add("SelectedValue", this.uxBindingSource, "NhomKhachHangId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="ChietKhauEditControlBase"/> class.
		/// </summary>
		public ChietKhauEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_ChietKhau != null) _ChietKhau.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxChietKhauId = new System.Windows.Forms.TextBox();
			uxChietKhauIdLabel = new System.Windows.Forms.Label();
			this.uxStartDate = new System.Windows.Forms.DateTimePicker();
			uxStartDateLabel = new System.Windows.Forms.Label();
			this.uxEndDate = new System.Windows.Forms.DateTimePicker();
			uxEndDateLabel = new System.Windows.Forms.Label();
			this.uxDieuKienGiamGiaId = new System.Windows.Forms.ComboBox();
			uxDieuKienGiamGiaIdLabel = new System.Windows.Forms.Label();
			this.uxGhiChu = new System.Windows.Forms.TextBox();
			uxGhiChuLabel = new System.Windows.Forms.Label();
			this.uxLastUpdate = new System.Windows.Forms.DateTimePicker();
			uxLastUpdateLabel = new System.Windows.Forms.Label();
			this.uxUpdateBy = new System.Windows.Forms.TextBox();
			uxUpdateByLabel = new System.Windows.Forms.Label();
			this.uxHeader = new System.Windows.Forms.TextBox();
			uxHeaderLabel = new System.Windows.Forms.Label();
			this.uxNhomKhachHangId = new System.Windows.Forms.ComboBox();
			uxNhomKhachHangIdLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxChietKhauIdLabel
			//
			this.uxChietKhauIdLabel.Text = "ChietKhauId:";
			this.uxChietKhauIdLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxChietKhauIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauIdLabel);			
			//
			// uxChietKhauId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxChietKhauId);
			this.uxChietKhauId.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxChietKhauId);
			//
			// uxStartDateLabel
			//
			this.uxStartDateLabel.Text = "StartDate:";
			this.uxStartDateLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxStartDateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxStartDateLabel);			
			//
			// uxStartDate
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxStartDate);
			this.uxStartDate.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxStartDate);
			//
			// uxEndDateLabel
			//
			this.uxEndDateLabel.Text = "EndDate:";
			this.uxEndDateLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxEndDateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxEndDateLabel);			
			//
			// uxEndDate
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxEndDate);
			this.uxEndDate.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxEndDate);
			//
			// uxDieuKienGiamGiaIdLabel
			//
			this.uxDieuKienGiamGiaIdLabel.Text = "DieuKienGiamGiaId:";
			this.uxDieuKienGiamGiaIdLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxDieuKienGiamGiaIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDieuKienGiamGiaIdLabel);			
			//
			// uxDieuKienGiamGiaId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDieuKienGiamGiaId);
			this.uxDieuKienGiamGiaId.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxDieuKienGiamGiaId);
			//
			// uxGhiChuLabel
			//
			this.uxGhiChuLabel.Text = "GhiChu:";
			this.uxGhiChuLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxGhiChuLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxGhiChuLabel);			
			//
			// uxGhiChu
			//
			this.uxGhiChu.Width = 250;
			this.uxGhiChu.Multiline = true;
			//this.uxGhiChu.Height = 80;
			//this.uxTableLayoutPanel.Controls.Add(this.uxGhiChu);
			this.uxGhiChu.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxGhiChu);
			//
			// uxLastUpdateLabel
			//
			this.uxLastUpdateLabel.Text = "LastUpdate:";
			this.uxLastUpdateLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxLastUpdateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdateLabel);			
			//
			// uxLastUpdate
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdate);
			this.uxLastUpdate.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxLastUpdate);
			//
			// uxUpdateByLabel
			//
			this.uxUpdateByLabel.Text = "UpdateBy:";
			this.uxUpdateByLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxUpdateByLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateByLabel);			
			//
			// uxUpdateBy
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateBy);
			this.uxUpdateBy.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxUpdateBy);
			//
			// uxHeaderLabel
			//
			this.uxHeaderLabel.Text = "Header:";
			this.uxHeaderLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxHeaderLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxHeaderLabel);			
			//
			// uxHeader
			//
			this.uxHeader.Width = 250;
			this.uxHeader.Multiline = true;
			//this.uxHeader.Height = 80;
			//this.uxTableLayoutPanel.Controls.Add(this.uxHeader);
			this.uxHeader.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxHeader);
			//
			// uxNhomKhachHangIdLabel
			//
			this.uxNhomKhachHangIdLabel.Text = "NhomKhachHangId:";
			this.uxNhomKhachHangIdLabel.Location = new System.Drawing.Point(3, 208);
			this.Controls.Add(this.uxNhomKhachHangIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNhomKhachHangIdLabel);			
			//
			// uxNhomKhachHangId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxNhomKhachHangId);
			this.uxNhomKhachHangId.Location = new System.Drawing.Point(160, 208);
			this.Controls.Add(this.uxNhomKhachHangId);
			//
			// uxNhomKhachHangId
			//				
			this.uxNhomKhachHangId.DisplayMember = "KhachHangId";	
			this.uxNhomKhachHangId.ValueMember = "NhomKhachHangId";	
			//
			// uxDieuKienGiamGiaId
			//				
			this.uxDieuKienGiamGiaId.DisplayMember = "DieuKienChung";	
			this.uxDieuKienGiamGiaId.ValueMember = "DieuKienId";	
			// 
			// ChietKhauEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "ChietKhauEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.NhomKhachHang> _NhomKhachHangIdList;
		
		/// <summary>
		/// The ComboBox associated with the NhomKhachHangId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.NhomKhachHang> NhomKhachHangIdList
		{
			get {return _NhomKhachHangIdList;}
			set 
			{
				this._NhomKhachHangIdList = value;
				this.uxNhomKhachHangId.DataSource = null;
				this.uxNhomKhachHangId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInNhomKhachHangIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the NhomKhachHangId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInNhomKhachHangIdList
		{
			get { return _allowNewItemInNhomKhachHangIdList;}
			set
			{
				this._allowNewItemInNhomKhachHangIdList = value;
				this.uxNhomKhachHangId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.DieuKienGiamGia> _DieuKienGiamGiaIdList;
		
		/// <summary>
		/// The ComboBox associated with the DieuKienGiamGiaId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.DieuKienGiamGia> DieuKienGiamGiaIdList
		{
			get {return _DieuKienGiamGiaIdList;}
			set 
			{
				this._DieuKienGiamGiaIdList = value;
				this.uxDieuKienGiamGiaId.DataSource = null;
				this.uxDieuKienGiamGiaId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInDieuKienGiamGiaIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the DieuKienGiamGiaId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInDieuKienGiamGiaIdList
		{
			get { return _allowNewItemInDieuKienGiamGiaIdList;}
			set
			{
				this._allowNewItemInDieuKienGiamGiaIdList = value;
				this.uxDieuKienGiamGiaId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
